
const express = require('express');
const router  = express.Router();
const alipayController=require('../controllers/alipayController')
// router.get("/", (req, res) => {
// 	res.render("index");
// });
router.post("/createInvoice", (req, res,next) => {
	alipayController.createInvoice(req,res)
});

// router.post("/callback", (req, res) => {
// 	var signStatus = req.alipayf2f.verifyCallback(req.body);
// 	console.log('signStatus:' + signStatus)
// 	if(signStatus === false) {
// 		return res.error("回调签名验证未通过");
// 	}

// 	var noInvoice = req.body["out_trade_no"];
// 	var invoiceStatus = req.body["trade_status"];

// 	if(invoiceStatus !== "TRADE_SUCCESS") {
// 		return res.send("success");
// 	}

// 	req.database.update(noInvoice, { pay: true }).then(result => res.send("success")).catch(err => res.catch(err));
// });



router.post("/checkInvoice", (req, res,next) => {
	 alipayController.checkInvoice(req,res)
});





router.get('/createQRCode', (req, res,next) => {
     alipayController.createQRCode(req,res)
});


module.exports = router;